listContents($path); foreach ($list as $item) { /** @var StorageAttributes $item */ if ($item->isFile() && str_ends_with($item->path(), '.php')) { return new MatchResult($path); } if ($item->isDir() && $item->path() === ltrim(rtrim($path, '/') . '/src', '/')) { return $this->match($fs, rtrim($path, '/') . '/src'); } } } catch (FilesystemException) { // skip dir if it is inaccessible } return new EmptyMatchResult(); } }